<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form id="fileForm" action="test.do" method="post" enctype="multipart/form-data">
    照片：<input type="file" name="file" onchange="selectFile();"/>
</form>
图片：<img src="http://image.baidu.com/search/detail?ct=503316480&z=undefined&tn=baiduimagedetail&ipn=d&word=%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87&step_word=&ie=utf-8&in=&cl=2&lm=-1&st=-1&cs=3552799060,760640595&os=2497075194,4029982641&simid=0,0&pn=1&rn=1&di=41383389300&ln=3980&fr=&fmq=1528337605843_R&fm=rs1&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&is=0,0&istype=0&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=0&oriquery=%E5%9B%BE%E7%89%87&objurl=http%3A%2F%2Fimg.taopic.com%2Fuploads%2Fallimg%2F110729%2F1830-110H916410651.jpg&rpstart=0&rpnum=0&adpicid=0" alt="图片显示" style="width:100px;height:100px;"/>
</body>

<script type="text/javascript">
    $("#fileForm").submit();
    function selectFile() {
    }
</script>

</html>